<html>
<head><meta charset="utf-8"><title>used externs · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/used.20externs.html">used externs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="221666301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/used%20externs/near/221666301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/used.20externs.html#221666301">(Jan 05 2021 at 16:19)</a>:</h4>
<p>where does the compiler decide whether or not a --extern rlib should be linked? i cannot for the life of me figure this out</p>



<a name="221666618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/used%20externs/near/221666618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/used.20externs.html#221666618">(Jan 05 2021 at 16:21)</a>:</h4>
<p>It is linked if any item inside it is used. Let me see where it checks this.</p>



<a name="221667597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/used%20externs/near/221667597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/used.20externs.html#221667597">(Jan 05 2021 at 16:29)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/e15ec667cee92d47c64fc903227b2fdb81f9e530/compiler/rustc_metadata/src/creader.rs#L941">https://github.com/rust-lang/rust/blob/e15ec667cee92d47c64fc903227b2fdb81f9e530/compiler/rustc_metadata/src/creader.rs#L941</a> is called by rustc_resolve. This will register the crate in the <code>CStore</code>. I haven't found where this information is exactly used though.</p>



<a name="221667670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/used%20externs/near/221667670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/used.20externs.html#221667670">(Jan 05 2021 at 16:29)</a>:</h4>
<p>yeah that's what i can't figure out either. lots of maps and sets of used and unused externs but nothing ever seems to use them</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>